<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="button" value="0" class="he">
</body>

</html>
<style>
    .he {
        width: 24px;
        height: 20px;
        background-color: rgb(109, 101, 101);
        margin-left: 50%;
    }
</style>
<script>
    var i = 0
    var he = document.querySelector(".he")
    he.onclick = function () {
        he.value = ++i
        alert(i)
    }
</script>